package com.jiutianniao.p2p.acctrans.core.trans;

import org.springframework.stereotype.Service;

import com.jiutianniao.p2p.acctrans.core.account.Account;
import com.jiutianniao.p2p.acctrans.core.exception.TransException;
import com.jiutianniao.p2p.trans.client.enums.AccountActionEnum;
import com.jiutianniao.p2p.trans.client.model.TransInfo;

@Service("withdrawTrans")
public class WithdrawTrans extends AbstractAccountTrans {

	@Override
	public Account fetchCreditAccount(TransInfo transInfo)
			throws TransException {
		String accountNoIn = transInfo.getTransAccountIn(); // 转入账号
		return this.fetchAccount(accountNoIn, AccountActionEnum.CREDIT,
				transInfo);
	}

	@Override
	public Account fetchDebitAccount(TransInfo transInfo) throws TransException {
		String accountNoOut = transInfo.getTransAccountOut(); // 转出账号
		return this.fetchAccount(accountNoOut, AccountActionEnum.WITHDRAW,
				transInfo);
	}
}
